﻿using System;

//namespace Common.Extensions
//{
    public static class DateTimeExtensions
    {
        public static string ToDateAndTime(this DateTime datetime)
        {
            return datetime.ToShortDateString() + " " + datetime.ToShortTimeString();
        }
        public static string ToDate(this DateTime datetime, string format)
        {
            var _format = "dd/MM/yyyy";
            if ( !string.IsNullOrEmpty(format) )
                _format = format;
            return String.Format("{0:" + _format + "}", datetime);
        }
        public static string ToTime(this DateTime datetime)
        {
            return String.Format("{0:HH:mm:ss}", datetime);
        }
    }
//}
